#pragma once
#include "afxwin.h"

#ifndef _SYSTEMTRAY_H
#define _SYSTEMTRAY_H

#include <shellapi.h>

class CSystemTray : public CCmdTarget
{
protected:
	DECLARE_DYNAMIC(CSystemTray)
	NOTIFYICONDATA m_nid;
public:
	CSystemTray(UINT uID);
	~CSystemTray(void);

	// Call this to receive tray notifications
	void SetNotificationWnd(CWnd* pNotifyWnd, UINT uCbMsg);

	BOOL SetTips(LPCSTR lpTip);
	// SetIcon functions. To remove icon, call SetIcon(0);
	BOOL SetIcon(UINT uID);
	BOOL SetIcon(HICON hIcon, LPCSTR lpTip );
	BOOL SetIcon(LPCTSTR lpResName, LPCSTR lpTip)	{ return SetIcon( lpResName ? AfxGetApp()->LoadIcon( lpResName) : NULL, lpTip); }

	BOOL SetStandardIcon(LPCTSTR lpszIconName, LPCSTR lpTip) { return SetIcon( ::LoadIcon( NULL, lpszIconName), lpTip); }

	virtual LRESULT OnTrayNotification(WPARAM uID, LPARAM lEvent);

};
#endif //_SYSTEMTRAY_H
